<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Student extends Model
{
    protected $hidden=['password'];
    public function school()
    {
        return $this->hasOne(School::class,'id','school_id')->field('id,name');
    }

    public function cate()
    {
        return $this->hasOne(StudentType::class,'id','student_type_id')->field('id,name');
    }


    public function getContactAttr(string $name)
    {
        return json_decode($name);
    }

    public function proceeds()
    {
        return $this->hasOne(Proceeds::class,'student_id','id')->bind(['money']);
    }
}
